nums = []
for s in range(10):
    n = int(input('请输入数字:'))
    nums.append(n)

print(nums)
length = len(nums)
count_swap = 0
count = 0

for i in range(length):
    flag = False
    for j in range(length - 1 - i):
        count += 1
        if nums[j] > nums[j + 1]:
            tmp = nums[j]
            nums[j] = nums[j + 1]
            nums[j + 1] = tmp
            flag = True
            count_swap += 1
    if not flag:
        break

print(nums, count_swap, count)
